//
//  BSFriendsViewController.m
//  sister
//
//  Created by 周冰烽 on 2017/2/7.
//  Copyright © 2017年 周冰烽. All rights reserved.
//

#import "BSFriendsViewController.h"
#import "BSRecommendViewController.h"
@interface BSFriendsViewController ()

@end

@implementation BSFriendsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = BSGlobalColor;
    [self setupUI];
    [self setupNavigation];
}

-(void)setupNavigation{
    //设置导航栏内容
    self.navigationItem.title = @"我的关注";
    //设置导航栏左边按钮
    self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithImage:@"friendsRecommentIcon" highImage:@"friendsRecommentIcon-click" target:self action:@selector(friendClick)];
}
-(void)friendClick{
    BSRecommendViewController *reVC = [[BSRecommendViewController alloc]init];
    [self.navigationController pushViewController:reVC animated:YES];
}
-(void)setupUI{
    //图片
    UIImageView *imageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"header_cry_icon"]];
    //中间文字
    UILabel *introduceLabel = [[UILabel alloc]init];
    introduceLabel.text = @"快快登录吧,关注百思最in牛人\n好友动态让你过把瘾儿~\n噢耶~~~";
    introduceLabel.numberOfLines = 0;//根据最大行数需求来设置
    introduceLabel.textAlignment = NSTextAlignmentCenter;
    introduceLabel.textColor = [UIColor grayColor];
    //登录按钮
    UIButton *LoginBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [LoginBtn setBackgroundImage:[UIImage imageNamed:@"friendsTrend_login"] forState:UIControlStateNormal];
    [LoginBtn setBackgroundImage:[UIImage imageNamed:@"friendsTrend_login_click"] forState:UIControlStateHighlighted];
    [LoginBtn setTitle:@"立即登录/注册" forState:UIControlStateNormal];
    [LoginBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [LoginBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted];
    imageView.translatesAutoresizingMaskIntoConstraints = NO;
    introduceLabel.translatesAutoresizingMaskIntoConstraints = NO;
    LoginBtn.translatesAutoresizingMaskIntoConstraints = NO;
    [self.view addSubview:imageView];
    [self.view addSubview:LoginBtn];
    [self.view addSubview:introduceLabel];

    NSDictionary *dictView = @{@"introduceLabel":introduceLabel,@"LoginBtn":LoginBtn,@"imageView":imageView};
    [self.view addConstraints:[NSLayoutConstraint
                              constraintsWithVisualFormat:@"[introduceLabel(235)]"
                              options:0
                              metrics:nil
                              views:dictView]];
    [self.view addConstraint:[NSLayoutConstraint
                              constraintWithItem:introduceLabel
                              attribute:NSLayoutAttributeCenterX
                              relatedBy:NSLayoutRelationEqual
                              toItem:self.view
                              attribute:NSLayoutAttributeCenterX
                              multiplier:1
                              constant:0]];
    [self.view addConstraint:[NSLayoutConstraint
                             constraintWithItem:introduceLabel
                             attribute:NSLayoutAttributeCenterY
                             relatedBy:NSLayoutRelationEqual
                             toItem:self.view
                             attribute:NSLayoutAttributeCenterY
                             multiplier:1
                             constant:0]];
    [self.view addConstraints:[NSLayoutConstraint
                              constraintsWithVisualFormat:@"H:[imageView(50)]"
                              options:0
                              metrics:nil
                              views:dictView]];
    [self.view addConstraints:[NSLayoutConstraint
                               constraintsWithVisualFormat:@"V:[imageView(50)]-50-[introduceLabel]"
                               options:0
                               metrics:nil
                               views:dictView]];
    [self.view addConstraint:[NSLayoutConstraint
                             constraintWithItem:imageView
                             attribute:NSLayoutAttributeCenterX
                             relatedBy:NSLayoutRelationEqual
                             toItem:introduceLabel
                             attribute:NSLayoutAttributeCenterX
                             multiplier:1
                              constant:0]];
    [self.view addConstraint:[NSLayoutConstraint
                             constraintWithItem:LoginBtn
                             attribute:NSLayoutAttributeCenterX
                             relatedBy:NSLayoutRelationEqual
                             toItem:introduceLabel
                             attribute:NSLayoutAttributeCenterX
                             multiplier:1
                              constant:0]];
    [self.view addConstraints:[NSLayoutConstraint
                              constraintsWithVisualFormat:@"V:[introduceLabel]-50-[LoginBtn(48)]"
                              options:0
                              metrics:nil
                               views:dictView]];
    [self.view addConstraints:[NSLayoutConstraint
                              constraintsWithVisualFormat:@"H:[LoginBtn(243)]"
                              options:0
                              metrics:nil
                               views:dictView]];
    
    
    
}
@end
